#ifndef __MOTOR_DRIVER_H__
#define __MOTOR_DRIVER_H__

//=====================================================================================================
#include "can_receive.h"
#include "pid.h"
/*-----------------selections
--------------------------------------------------------
@brief:
*/


/*-----------------settings
--------------------------------------------------------
@brief:
*/
// 3508电机速度环PID
#define RM3508_SPEED_PID_KP 15000.0f
#define RM3508_SPEED_PID_KI 10.0f
#define RM3508_SPEED_PID_KD 0.0f

// 3508电机位置环PID
#define RM3508_POSITION_PID_KP 0.00009f
#define RM3508_POSITION_PID_KI 0.0f
#define RM3508_POSITION_PID_KD 0.000006f

// 6020电机速度环PID
#define RM6020_SPEED_PID_KP 2900.0f
#define RM6020_SPEED_PID_KI 60.0f
#define RM6020_SPEED_PID_KD 0.0f

// 6020位置环PID参数
#define RM6020_POSITION_PID_KP 2682.0f
#define RM6020_POSITION_PID_KI 0.0f
#define RM6020_POSITION_PID_KD 0.0f

// 2006位置环PID参数
#define RM2006_POSITION_PID_KP  0.0f
#define RM2006_POSITION_PID_KI  0.0f
#define RM2006_POSITION_PID_KD  0.0f

/*-----------------definitions
--------------------------------------------------------
@brief:
*/
// 3508电机最大发送电流值
#define RM3508_MAX_OUT 16000.0f 
#define RM3508_MAX_IOUT 2000.0f

// 3508电机转化成底盘速度(m/s)的比例，
#define M3508_MOTOR_RPM_TO_VECTOR 0.000415809748903494517209f

// 6020电机最大发送电流值
#define RM6020_MAX_OUT  30000.0f
#define RM6020_MAX_IOUT 10000.0f

// 2006电机最大发送电流值
#define RM2006_PID_MAX_OUT 10000.0f
#define RM2006_PID_MAX_IOUT 7000.0f

//=====================================================================================================

/*-----------------params
--------------------------------------------------------
@brief:
*/
// 电机索引
typedef enum motor_index
{
    RM3508_1 = 0,
    RM3508_2,
    RM3508_3,
    RM3508_4,

    RM6020_pitch = 5,
    RM6020_yaw,
    RM2006_trigger,

} motor_index_e;

//
typedef struct motor_data
{
    motor_measure_t *RM3508_measure[4];
    motor_measure_t *RM6020_measure[2];
    motor_measure_t *RM2006_measure[1];

    pid_type_def rm3508_speed_pid[4];
    //pid_type_def rm3508_positon_pid[4];
    //pid_type_def rm6020_speed_pid[2];
    pid_type_def rm6020_positon_pid[2];
    //pid_type_def rm2006_speed_pid[1];
    pid_type_def rm2006_positon_pid[1];
} motor_data_t;

/*-----------------functions
--------------------------------------------------------
@brief:
*/
//



/*-----------------XXX API_h
--------------------------------------------------------
@brief:
*/
//


/*------------------------end-------------------------*/
#endif